import { reqRandomCityInfo, reqRandomHotelInfo, reqRandomRoomInfo, reqRandomAroundInfo } from '@/api'

export default {
  // namespaced: true,
  actions: {
    async getRandomCity({ commit }) {
      let res = await reqRandomCityInfo()
      console.log(res)
      if (res.code == 200) {
        commit('GETRANDOMCITYINFO', res.result)
      }
    },
    async getRandomHotel({ commit }) {
      let res = await reqRandomHotelInfo()
      console.log(res)
      if (res.code == 200) {
        commit('GETRANDOMHOTELINFO', res.result)
      }
    },
    async getRandomRoom({ commit }) {
      let res = await reqRandomRoomInfo()
      console.log(res)
      if (res.code == 200) {
        commit('GETRANDOMROOMINFO', res.result)
      }
    },
    async getRandomAround({ commit }) {
      let res = await reqRandomAroundInfo()
      console.log(res)
      if (res.code == 200) {
        commit('GETRANDOMAROUNDINFO', res.result)
      }
    },
  },
  mutations: {
    GETRANDOMCITYINFO(state, data) {
      state.randomCity = data
    },
    GETRANDOMHOTELINFO(state, data) {
      state.randomHotel = data
    },
    GETRANDOMROOMINFO(state, data) {
      state.randomRoom = data
    },
    GETRANDOMAROUNDINFO(state, data) {
      state.randomAround = data
    },
  },
  state: {
    randomCity: [],
    randomHotel: [],
    randomRoom: [],
    randomAround: [],
  },
  getters: {
  },
  modules: {
  }
}